<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script  src="<?=base_url()?>fckeditor/fckeditor.js" language="javascript"></script>
<link href="<?=base_url()?>system/application/views/css/admin_edit.css" rel="stylesheet" type="text/css" />

<title>添加商品</title>
<style type="text/css">
#newPreview
{
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
</style>
<script type="text/javascript" language="javascript">
<!--
function PreviewImg(imgFile)
{
    
    
    //新的预览代码，支持 IE6、IE7。
    var newPreview = document.getElementById("newPreview");
    newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile;
	var image=new Image();
	image.src=imgFile.src;
    newPreview.style.width = "160px";
    newPreview.style.height = "130px";
}
-->
</script>
<script>
         var  myfck = new  FCKeditor('main_content');
		 myfck.Width = 600;
		 myfck.Height = 300;
		 myfck.BasePath = '<?=base_url()?>fckeditor/';
		 function  $(id){
		     return  document.getElementById(id);
		 }
		 function  clonediv(){ 
		     var  divchild =  $('file1').cloneNode(true);//克隆结点
			  divchild.style.display = 'block';//把已克隆的结点显示
			  $('out').appendChild(divchild);//把结点加入到id为out的div中
		 }
		 
		 function  insertfile(obj){
		     var oEditor = FCKeditorAPI.GetInstance('mycontent');//实例化fck中的api对象
		    
			// alert(obj);
			var  file_url = obj.parentNode.firstChild.value;//obj
			//alert(file_url);
			  file_url = file_url.replace(":",'|');
			  file_url = file_url.replace('\\','/');
			  file_url = "<img src=\"file:///"+file_url+"\">";
			  target_url = "file:///"+file_url;
			  alert(file_url);
			 oEditor.InsertHtml(file_url);
			 obj.nextSibling.value = target_url;
			 //调用api对象中的insertHtml方法将括号里的内容插入fck
		 }


</script>

</head>
<body>
<div class="wrap">
<table id="mytable" cellspacing="0"> 
<form method="post" action="<?=base_url()?>index.php/add_product/add" enctype="multipart/form-data">
<tr> 
<th scope="col">产品名称</th> 
<td class="row"><input type="text" name="title"  /></td>

<tr> 
<th class="row">产品类别</th> 
<td class="row"><select name="sortid">
        <?php foreach ($child as $value){?><option value="<?php echo $value->sortid?>">
		 <?php for($i=0;$i<$value->deep;$i++){echo "^_^";} echo $value->title;?></option>
		 <?php }?>
		</select></td> 
</tr> 
<tr>
<th class="col">简要介绍</th>
<td class="row"><input  type="text" name="content" /></td>
</tr>
<tr>
<th class="col">价格</th>
<td class="row"><input  type="text" name="price" /></td>
</tr>

<tr height="100px">
<th class="col">图片</th>
<td class="row">图片预览<div id="newPreview"></div><input type="file" name="userfile" onchange="javascript:PreviewImg(this.value);" /></td>
</tr>


<tr>
<th class="col">详细介绍</th>
<td class="row"><script language="javascript">
	      myfck.Create();
	  </script></td>
</tr>
<tr>
<th class="col">是否热卖</th><td class="row"><input type="radio" name="bestseller" value="0">否 <input type="radio" name="bestseller" value="1">是</td>
</tr>
<tr>
<th class="col">是否新品</th><td class="row"><input type="radio" name="new" value="0">否 <input type="radio" name="new" value="1">是</td>
</tr>
<tr>
<th class="col">是否上架</th><td class="row"><input type="radio" name="online" value="0">否 <input type="radio" name="online" value="1">是</td>
</tr>

<tr><td align="center" colspan="2"><input type="submit" value="ok"/></td></tr>
 </form>
</table> 

</div>
</body>
</html>